package com.restaurant.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.restaurant.entity.Publish;
import com.restaurant.mapper.DeptMapper;
import com.restaurant.service.DeptService;
import com.restaurant.service.PublishService;

@Controller
@RequestMapping("show")
public class PublishController {
	@Autowired
	private PublishService  publishService;
	

	public PublishService getPublishService() {
		return publishService;
	}



	public void setPublishService(PublishService publishService) {
		this.publishService = publishService;
	}


	@RequestMapping("/menuList")
	public ModelAndView  test() {
		ModelAndView andView  = new ModelAndView();
			
			List<Publish> publishmenus= publishService.findMenu();
			
			andView.addObject("publishmenus", publishmenus);
			andView.setViewName("dingcan");
		return andView;
	}
	
	
	@RequestMapping("/checkMenuByweek")
	public ModelAndView  checkMenuByweek(Integer week) {
		ModelAndView andView  = new ModelAndView();
			
			List<Publish> publishmenus= publishService.checkMenuByweek(week);
			
			andView.addObject("publishmenus", publishmenus);
			andView.setViewName("dingcan");
		return andView;
	}
}
